import java.io.*;
public class WriteFile {

	public static void write(String s,String file){
		try{
			  // Create file 
			PrintWriter pw=new PrintWriter(new FileWriter(file,true));
			  
			  pw.append(s);
			  //Close the output stream
			  pw.println();
			  pw.close();
			  }catch (Exception e){//Catch exception if any
			  System.err.println("Error: " + e.getMessage());
			  }
	}
}
